package com.changan.response;

/**
 * @ClassName CommonReturnType
 * @Description 公共数据返回类
 * @Version 1.0
 **/
public class CommonReturnType {
    //表明对应请求的返回处理结果“success”或false
    private String status;
    //若status=success，则data内返回前端需要的json格式
    //若status=false，则data内使用通用的错误码格式
    private Object data;

    //定义一个通用的创建方法
    public static CommonReturnType create(Object result) {
        return CommonReturnType.create("success", result);
    }

    public static CommonReturnType create(String status, Object result) {
        CommonReturnType type = new CommonReturnType();
        type.setStatus(status);
        type.setData(result);
        return type;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
